{% extends "stream/base.html" %}

{% block title %}
    Your recommendations
{% endblock %}

{% block scripts %}
    <script type="text/javascript" src="/js/common.js"></script>
    <script>
        var page_data = {};
        
        function RequestRecommendations(tags) {
            var parameters = new Parameters();
            parameters.tags = TagsToPath(tags);
            $.ajaxSetup({
                processData: false
            })

            $.getJSON('/searchUsersData', parameters.toString(), function(data) {
                page_data.recommendations = data;
                $.each(data, function(i, item) {
                    $('.Recommendations').append(
                        $('<div/>').append(
                            'User:'
                        ).append(
                            GenerateLinkMarkup('span', '/' + item.user.id.toString(), item.user.display_name)
                        ).append(
                            'Matching tags: ' + item.tags.join(', ')
                        )
                    )
                })
            })
            $.ajaxSetup({
                processData: true
            })
        }

        function Init() {
            RequestRecommendations(page_stats.tags);
        }

        $(document).ready(Init);
    </script>
{% endblock %}

{% block content %}
<div class="Recommendations">
    
</div>
{% endblock%}
